package com.caigou.modules.famous.widget

import android.app.Dialog
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.view.Window
import android.widget.RadioButton
import android.widget.RadioGroup
import com.caigou.modules.famous.R

/**
 * @author #Suyghur.
 * Created on 2021/12/09
 */
class FamousTypeDialog(context: Context, private val type: Int) : Dialog(context) {

    lateinit var rgFamousType: RadioGroup
    lateinit var btnHkFamous: RadioButton
    lateinit var btnMacaoFamous: RadioButton

    init {
        setCanceledOnTouchOutside(true)
        window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
        requestWindowFeature(Window.FEATURE_NO_TITLE)
        initView()
    }

    private fun initView() {
        setContentView(R.layout.dialog_famous_type)

        rgFamousType = findViewById(R.id.famous_type_rg_selector)
        btnHkFamous = findViewById(R.id.famous_type_btn_hk)
        btnMacaoFamous = findViewById(R.id.famous_type_btn_macao)
        if (type == 1) {
            btnHkFamous.isChecked = true
            btnMacaoFamous.isChecked = false
        } else {
            btnHkFamous.isChecked = false
            btnMacaoFamous.isChecked = true
        }
    }
}